package com.newdjk.newdoctor.utils;


import android.content.Intent;

import com.newdjk.newdoctor.MyApplication;
import com.newdjk.newdoctor.R;
import com.newdjk.newdoctor.entity.AppLicationEntity;
import com.newdjk.newdoctor.ui.InviteDoctorActivity;
import com.newdjk.newdoctor.ui.MyPatientActivity;

import java.util.ArrayList;
import java.util.Collection;
import java.util.List;

/*
 *  @项目名：  Doctor
 *  @包名：    com.newdjk.doctor.utils
 *  @文件名:   AppLicationUtils
 *  @创建者:   huhai
 *  @创建时间:  2019/1/17 14:42
 *  @描述：
 */
public class AppLicationUtils {

    static List<AppLicationEntity> listmedical = new ArrayList<>();
    static List<AppLicationEntity> listOperate = new ArrayList<>();
    static List<AppLicationEntity> listConfigual = new ArrayList<>();
    static List<AppLicationEntity> listRoleType = new ArrayList<>();

    public static int getimageID(String des) {
        int defaultiID = R.mipmap.ic_launcher;
        switch (des) {
            case "药品集采":
                defaultiID = R.drawable.icon_yaopincaiji;
                break;
            case "用户管理":
                defaultiID = R.drawable.icon_wodehuanzhe;
                break;
            case "快速售药":
                defaultiID = R.drawable.icon_kuaisushouyao;
                break;
            case "申请坐诊":
                defaultiID = R.drawable.icon_shenqingzuozhen;
                break;
            case "医废申请":
                break;
            case "邀请医护":
                defaultiID = R.drawable.icon_yaoqingyihu;
                break;
            case "发布公告":
                defaultiID = R.drawable.icon_fabugonggao;
                break;
            case "申请处方":
                defaultiID = R.drawable.icon_wodechufang;
                break;
            case "扫码入库":
                defaultiID = R.drawable.icon_saomaruku;
                break;

            case "基础设置":
                defaultiID = R.drawable.icon_jishushezhi;
                break;
            case "优选推荐":
                defaultiID = R.drawable.icon_youxuantuijian;
                break;
            case "处方申请记录":
                defaultiID = R.drawable.icon_wodechufang;
                break;
            case "坐诊订单":
                defaultiID = R.drawable.icon_zuozhendingdan;
                break;
            case "采购订单":
                defaultiID = R.drawable.icon_caigoudingdan;
                break;
            case "售药记录":
                defaultiID = R.drawable.icon_shouyaojilu;
                break;
            case "医废申请订单":
                defaultiID = R.drawable.icon_yifeiorder;
                break;
            case "分享店铺":
                defaultiID = R.drawable.icon_dianpu;
                break;
            case "VIP预约推荐":
                defaultiID = R.drawable.vip;
                break;
            case "特色服务推荐":
                defaultiID = R.drawable.icon_tuijiantiyan;
                break;
            case "肺癌早筛":
                defaultiID = R.drawable.icon_feiai;
                break;
            case "处方审核":
                defaultiID = R.drawable.icon_shenhe;
                break;
            case "调配核对":
                defaultiID = R.drawable.icon_tiaopei;
                break;
            case "服务包推荐记录":
                defaultiID = R.drawable.icon_fuwubao;
                break;
            case "购药回访":
                defaultiID = R.drawable.yaodianhuifang;
                break;

            case "处方套餐订单":
                defaultiID = R.drawable.icon_chufangtaocan;
                break;

            case "更多服务":

                defaultiID = R.drawable.all_function;
                break;
        }
        return defaultiID;
    }

    public static List<AppLicationEntity> getOperate() {
        listOperate.clear();
        int role = 0;
        if (MyApplication.LoginEntity != null) {
            role = MyApplication.LoginEntity.getUser().getRoleType();
        }

        if (role == 0 || role == 1 || role == 3) {
            AppLicationEntity appLicationEntity5 = new AppLicationEntity();
            appLicationEntity5.setAppDesc("申请坐诊");
            appLicationEntity5.setIsselect(true);
            listOperate.add(appLicationEntity5);
        }

        if (role == 0 || role == 4 || role == 6 || role == 7 || role == 8 || role == 9 || role == 10) {
            AppLicationEntity appLicationEntity6 = new AppLicationEntity();
            appLicationEntity6.setAppDesc("用户管理");
            listOperate.add(appLicationEntity6);
        }

        if (role == 0 || role == 1 || role == 3 || role == 4 || role == 6 || role == 7 || role == 8 || role == 9 || role == 10) {
            AppLicationEntity appLicationEntity7 = new AppLicationEntity();
            appLicationEntity7.setAppDesc("发布公告");
            listOperate.add(appLicationEntity7);
        }


        if (role >= 0 && role <= 10) {
//            AppLicationEntity appLicationEntity8 = new AppLicationEntity();
//            appLicationEntity8.setAppDesc("优选推荐");
//            listOperate.add(appLicationEntity8);

//            AppLicationEntity appLicationEntity9 = new AppLicationEntity();
//            appLicationEntity9.setAppDesc("特色服务推荐");
//            listOperate.add(appLicationEntity9);

            AppLicationEntity appLicationEntity10 = new AppLicationEntity();
            appLicationEntity10.setAppDesc("VIP预约推荐");
            listOperate.add(appLicationEntity10);


            AppLicationEntity appLicationEntity11 = new AppLicationEntity();
            appLicationEntity11.setAppDesc("肺癌早筛");
            listOperate.add(appLicationEntity11);


        }

        if (role == 0 || role == 4 || role == 6 || role == 7 || role == 8 || role == 9 || role == 10) {
            AppLicationEntity appLicationEntity12 = new AppLicationEntity();
            appLicationEntity12.setAppDesc("购药回访");
            listOperate.add(appLicationEntity12);
        }


        return listOperate;
    }

    public static List<AppLicationEntity> getConfigua() {
        listConfigual.clear();
        //// 1诊所，2医生，3诊所并且是医生,4，药房  0啥都不是  诊所无申请处方
        int role = 0;
        if (MyApplication.LoginEntity != null) {
            role = MyApplication.LoginEntity.getUser().getRoleType();
        }


        if (role == 0 || role == 1 || role == 3) {
            AppLicationEntity appLicationEntity8 = new AppLicationEntity();
            appLicationEntity8.setAppDesc("基础设置");
            listConfigual.add(appLicationEntity8);


            AppLicationEntity appLicationEntity10 = new AppLicationEntity();
            appLicationEntity10.setAppDesc("邀请医护");
            listConfigual.add(appLicationEntity10);
        }

        if (role == 0 || role == 1 || role == 3 || role == 4 || role == 6 || role == 7 || role == 8 || role == 9 || role == 10) {
            AppLicationEntity appLicationEntity9 = new AppLicationEntity();
            appLicationEntity9.setAppDesc("分享店铺");
            listConfigual.add(appLicationEntity9);
        }


        return listConfigual;
    }

    public static List<AppLicationEntity> getMedical() {
        //// 1诊所，2医生，3诊所并且是医生,4，药房  0啥都不是  诊所无申请处方
        int role = 0;
        if (MyApplication.LoginEntity != null) {
            role = MyApplication.LoginEntity.getUser().getRoleType();
        }

        listmedical.clear();


        if (role == 0 || role == 1 || role == 3 || role == 4 || role == 6 || role == 7 || role == 8 || role == 9 || role == 10) {
//            AppLicationEntity appLicationEntity1 = new AppLicationEntity();
//            appLicationEntity1.setAppDesc("药品集采");
//            listmedical.add(appLicationEntity1);
        }

        if (role == 0 || role == 4 || role == 6 || role == 7 || role == 8 || role == 9 || role == 10) {
            AppLicationEntity appLicationEntity3 = new AppLicationEntity();
            appLicationEntity3.setAppDesc("申请处方");
            listmedical.add(appLicationEntity3);

        }

        if (role == 0 || role == 1 || role == 3 || role == 4 || role == 6 || role == 7 || role == 8 || role == 9 || role == 10) {
            AppLicationEntity appLicationEntity2 = new AppLicationEntity();
            appLicationEntity2.setAppDesc("快速售药");
            listmedical.add(appLicationEntity2);
        }

        if (role == 0 || role == 1 || role == 3 || role == 4 || role == 6 || role == 7 || role == 8 || role == 9 || role == 10) {
            AppLicationEntity appLicationEntity4 = new AppLicationEntity();
            appLicationEntity4.setAppDesc("扫码入库");
            listmedical.add(appLicationEntity4);
        }

        if (role == 0 || role == 4 || role == 9 || role == 10 || role == 12) {


            AppLicationEntity appLicationEntity6 = new AppLicationEntity();
            appLicationEntity6.setAppDesc("处方审核");
            listmedical.add(appLicationEntity6);

        }

        if (role == 0 || role == 4 || role == 6 || role == 7 || role == 8 || role == 10) {


            AppLicationEntity appLicationEntity6 = new AppLicationEntity();
            appLicationEntity6.setAppDesc("调配核对");
            listmedical.add(appLicationEntity6);

        }
        return listmedical;
    }


    public static List<AppLicationEntity> getLearn() {
        listmedical.clear();
        if (listmedical.size() == 0) {
            AppLicationEntity appLicationEntity1 = new AppLicationEntity();
            appLicationEntity1.setAppDesc("医届头条");
            listmedical.add(appLicationEntity1);

        }
        return listmedical;
    }


    //我得界面
    public static List<AppLicationEntity> getroletype(int roletype) {


        listRoleType.clear();
        if (listRoleType.size() == 0) {
            // 1老板，2医生，3老板并且是医生,4，药房  0啥都不是

            //诊所老板/诊所老板兼医生


            if (roletype == 0 || roletype == 1 || roletype == 3 || roletype == 4 || roletype == 6 || roletype == 7 || roletype == 8 || roletype == 9 || roletype == 10) {
                AppLicationEntity appLicationEntity6 = new AppLicationEntity();
                appLicationEntity6.setAppDesc("采购订单");
                listRoleType.add(appLicationEntity6);

                AppLicationEntity appLicationEntity1 = new AppLicationEntity();
                appLicationEntity1.setAppDesc("售药记录");
                listRoleType.add(appLicationEntity1);
            }


            if (roletype >= 0 && roletype <= 10) {
                AppLicationEntity appLicationEntity2 = new AppLicationEntity();
                appLicationEntity2.setAppDesc("优选推荐");
                listRoleType.add(appLicationEntity2);

                AppLicationEntity appLicationEntity5 = new AppLicationEntity();
                appLicationEntity5.setAppDesc("服务包推荐记录");
                listRoleType.add(appLicationEntity5);
            }
            if (roletype == 0 || roletype == 1 || roletype == 3) {
                AppLicationEntity appLicationEntity4 = new AppLicationEntity();
                appLicationEntity4.setAppDesc("坐诊订单");
                listRoleType.add(appLicationEntity4);
            }

            if (roletype == 0 || roletype == 4 || roletype == 6 || roletype == 7 || roletype == 8 || roletype == 9 || roletype == 10) {
                AppLicationEntity appLicationEntity1 = new AppLicationEntity();
                appLicationEntity1.setAppDesc("处方申请记录");
                listRoleType.add(appLicationEntity1);

                AppLicationEntity appLicationEntity7 = new AppLicationEntity();
                appLicationEntity7.setAppDesc("处方套餐订单");
                listRoleType.add(appLicationEntity7);
            }

        }
        return listRoleType;
    }
}
